#include<cstdio> 
using namespace std; 
const int maxn=100001;
struct node
{
    int left,right;
    long long add;
    long long sum;
};
 
node tree[4*maxn];
long long a[maxn]; 
void PushUp(int u)
{
	tree[u].sum=tree[u*2].sum+tree[u*2+1].sum;
}
void PushDown(int u)
{
	tree[u*2].sum+=tree[u].add*(tree[u*2].right-tree[u*2].left+1);
	tree[u*2+1].sum+=tree[u].add*(tree[u*2+1].right-tree[u*2+1].left+1);
	tree[u*2].add+=tree[u].add;
	tree[u*2+1].add+=tree[u].add;
	tree[u].add=0;
}
long long build(int L,int R,int u)
{
    long long i,j;
    tree[u].left=L;
    tree[u].right=R;
    tree[u].add=0;
    if(L!=R)
    {
        i=build(L,(L+R)/2,u*2);
        j=build((L+R)/2+1,R,u*2+1);
    }
    else
    {
        tree[u].sum=a[L];
        return(a[L]);
    }
    tree[u].sum=i+j;
    return(tree[u].sum);
}
 
void insert(int L,int R,int add,int u)
{
     
    if(L<=tree[u].left&&tree[u].right<=R)
    {
        tree[u].add+=add;
        tree[u].sum+=add*(tree[u].right-tree[u].left+1);
        return;
    }
    if(tree[u].add)PushDown(u);
	if(L<=(tree[u].left+tree[u].right)/2)
        insert(L,R,add,u*2);
    if(R>(tree[u].left+tree[u].right)/2)
        insert(L,R,add,u*2+1);
    PushUp(u);     
}
 

long long search(int L,int R,int u)
{
    long long i=0,j=0;
    if(L<=tree[u].left&&tree[u].right<=R)
    {
        return(tree[u].sum);
    }
    if(tree[u].add)PushDown(u);
	if(L<=(tree[u].left+tree[u].right)/2)
    {
        i=search(L,R,u*2);
         
    }
    if(R>(tree[u].left+tree[u].right)/2)
    {
        j=search(L,R,u*2+1);
         
    }
     
    return(i+j);
}
 
 
int main()
{
   	int i,j,k,n,m,p,t;
    char s;
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++)
        scanf("%lld",&a[i]);
    build(1,n,1);
    for(i=1;i<=m;i++)
    {
        scanf("\n%c",&s);
        if(s=='C')
        {
            scanf("%d%d%d",&j,&k,&p);
            if(j>k) {t=j;j=k;k=t;}
            insert(j,k,p,1);
        }
        else
        {
            scanf("%d%d",&j,&k);
            if(j>k) {t=j;j=k;k=t;}
            printf("%lld\n",search(j,k,1));
        }
    }
 
    return 0;
}
